<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="../../../common/taglib.jsp"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>产品列表</title>
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<link href="${ctx }/css/style.css" type="text/css" rel="stylesheet" />
		<link href="${ctx }/css/page.css" type="text/css" rel="stylesheet" />
		<script type="text/javascript" src="${ctx }/js/jquery/jquery-1.6.1.min.js"></script>
		<script type="text/javascript">
			$(function() {
				$("#btnSearch").click(function() {
					$("form:first").submit();
				});
			});

			inCart = function(id) {
				var user = '<s:property value="#session.user" />';

				if (null == user || "" == user || "null" == user) {
					alert("请登录后购买！");
					self.close();
				}

				window.open("${ctx}/shopping/addToShoppingCart.action?cardType=" + id);
			}
		</script>
	</head>
	<body>
		<s:form id="form1" action="listAllCardProduct" method="post" namespace="/card">
			<div>
				<div style="width: 100%; height: 35px; background-color: #CCE5FF; color: Blue; line-height: 35px;">
					&nbsp;&nbsp;我的购物车
					<img alt="" src="${ctx }/images/shoppingcart.gif" style="width: 19px; border: none;" />
					&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 商品搜索：
					<s:textfield name="cardTypeName" cssStyle="width: 150px;"></s:textfield>
					&nbsp;
					<input id="btnSearch" type="button" value="在所有商品中查询" style="width: 128px;" />
				</div>

				<div style="width: 100%;">
					<img alt="" src="${ctx }/images/chanpinliebiao.gif" style="border: none;" />
				</div>
				<div style="width: 100%; color: blue;">
					<table cellspacing="0" cellpadding="3" rules="rows" border="1" style="background-color:White;border-color:#E7E7FF;border-width:1px;border-style:None;width:100%;border-collapse:collapse;">
						<s:if test="page.data.size() == 0">
							<tr align="center">
								<td style="color:Black;background-color:White;">
									暂无产品信息！
								</td>
							</tr>
						</s:if>
						<s:else>
							<s:iterator value="page.data" status="st" var="product">
								<tr>
									<td style='color: black; <s:if test="#st.odd">background-color:white;</s:if><s:else>background-color:#E8F9E8;</s:else>'>
										<div style="float:left;height:100px">
											<img alt="" src='${ctx }/<s:property value="cardImage" />' style="width:100px;border-width:0px;" />
										</div>
										<div style="float:left;width:15px;height:100px"></div>
										<div style="float:left;text-align:left">
											卡片名称：
											<span>
												<s:property value="cardTypeName" />
											</span><br/>
											面值：
											<s>
												￥
												<span>
													<s:property value="price.intValue()" />
												</span>
											</s><br/>
											会员价：<span style="color:Red;">￥</span>
											<spanstyle="color:Red;">
												<s:property value="memberPrice" />
											</span>
											&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
											vip价：<span style="color:Red;">￥</span>
											<span style="color:Red;">
												<s:property value="vipPrice" />
											</span> 
											&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
											<s:if test="#product.num != 0">
												<input type="image" src="${ctx }/images/shoppingcart.gif" style="border-width:0px;" onclick="inCart('<s:property value="cardType" />');" />
												<span style="color:Blue;">放入购物车</span>
											</s:if>	
											<s:else>
												<span style="color: red;">断货</span>
											</s:else>
										</div>									
									</td>
								</tr>
							</s:iterator>
						</s:else>
						<tfoot>
							<tr>
								<td align="center">
									<gc:page pageSize="${page.pageSize}" 
										totalCount="${page.totalCount}" 
										formId="form1" 
										totalPageCount="${page.totalPageCount}" 
										currentPageNo="${page.currentPageNo}" />
								</td>
							</tr>
						</tfoot>
					</table>
				</div>
			</div>
		</s:form>
	</body>
</html>
